/*=============================================================================
#    The element-comm is a tentative program used to test our ideas.           
#                       Copyright (C)  bgao                                    
#
#     This program is free software; you can redistribute it and/or            
#      modify it under the terms of the GNU General Public License             
#     as published by the Free Software Foundation; either version 2           
#         of the License, or (at your option) any later version.               
#
#     This program is distributed in the hope that it will be useful,          
#    but WITHOUT ANY WARRANTY; without even the implied warranty of           
#     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the            
#             GNU General Public License for more details.                    
#
#    You should have received a copy of the GNU General Public License        
#     along with this program; if not, write to the Free Software             
#      Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,             
#                       MA  02110-1301, USA.                                  
#==============================================================================
# $Id$ 
#
# $Author$ 
#
# $Revision$ 
#
# $Date$ 
#
# Description: 
#
=============================================================================*/
#ifndef __GAINZ_H
#define __GAINZ_H

#include <avr/io.h>

/********* LED I/O ***************/
/*PORTA*/
#define PORT_LED	PORTA
#define LED_YELLOW	0 //PA0 - Output
#define LED_GREEN	1 //PA1 - Output
#define LED_RED		2 //PA2 - Output

/********* CC2420 I/O ***********/
#define PORT_2420_VREG       PORTA
#define PORT_2420_RESET       PORTA
#define VREG_EN        5  // PA5 - Output: VREG_EN to CC2420
#define RESET_N        6  // PA6 - Output: RESET_N to CC2420

#define PORT_2420_CS      PORTB
#define PORT_2420_FIFO    PINB
#define CSN            0  // PB0 - Output: SPI Chip Select (CS_N)
#define SCK            1  // PB1 - Output: SPI Serial Clock (SCLK)
#define SI             2  // PB2 - Output: SPI Master out - slave in (MOSI)
#define SO             3  // PB3 - Input:  SPI Master in - slave out (MISO)
#define FIFO           7  // PB7 - Input: FIFO from CC2420

#define PORT_2420_CCA		PIND
#define PORT_2420_SFD		PIND
#define SFD            4  // PD4 - Input:  SFD from CC2420
#define CCA            6  // PD6 - Input:  CCA from CC2420

#define PORT_2420_FIFOP		PINE
#define FIFOP         6  // PE6 - Input: FIFOP from CC2420

/********* SENSOR I/O ***********/
#define LIGHT_EN       5  // PE5 - Output:
#define TEMP_EN 	   6  // PE6 - Output:
#define ADC_IN         1  // PF1 - Input:

/**********ATMEG128************/
#define HAL_CPU_CLOCK_MHZ 8


#define SPI_TX_REG 		SPDR
#define SPI_RX_REG 		SPDR 
#define SPI_STATUS_REG 	SPSR
#define SPI_TX_READY	7 //bit7 of SPSR,Transfer finish Flag




#endif

